package day12homework;

import java.util.Scanner;

import org.junit.Test;

public class SquareRoot {

	public  void SquareRoot() throws MyException {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入一个数：");
		double number = scanner.nextInt();
		double result;
		if(number >= 0) {
			result = Math.sqrt(number);
			System.out.println(number + "的平方根为" + result);
		}else {
			throw new MyException(number);
		}
	}
}
